package vn.pdg.zoombie.ui;

import java.io.File;

import vn.pdg.zoombie.bean.Utils;
import vn.pdg.zoombie.ui.zoomimager.ImageViewTouch;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class GallerySelectedPhoto extends BaseActivity {
	
	public static final String EXTRA_SELECT_PHOTO = "EXTRA_SELECT_PHOTO";
	public static final String EXTRA_URL_PHOTO = "EXTRA_URL_PHOTO";
	
	private Button btSaveLibrary;
	private Button btShare;
	private Button btProfile;
	private ImageViewTouch imageSelect;
	private String urlPhoto;
	@Override
	protected void onCreate(Bundle aSavedInstanceStatea) {
		// TODO Auto-generated method stub
		super.onCreate(aSavedInstanceStatea);
		setContentView(R.layout.gallery_select_photo);
		
		loadControl();
		Intent data 	= getIntent();
		urlPhoto 		= data.getStringExtra(EXTRA_URL_PHOTO);
		Bitmap b = Utils.decodeFile(new File(urlPhoto), 320);
		imageSelect.setImageBitmapReset(b, 0, true);
		
	}
	
	
	@Override
	public void loadControl() {
		// TODO Auto-generated method stub
		super.loadControl();
		imageSelect		= (ImageViewTouch) findViewById(R.id.image_select_photo);
		btSaveLibrary 	= (Button) findViewById(R.id.bt_save_photo);
		btProfile		= (Button) findViewById(R.id.bt_profile);
		btShare			= (Button) findViewById(R.id.bt_share);
		
		btProfile.setOnClickListener(this);
		btSaveLibrary.setOnClickListener(this);
		btShare.setOnClickListener(this);
		
		btBack.setBackgroundResource(R.drawable.cancel_button);
		layoutMenu.setBackgroundResource(R.drawable.menu_gallery);
		titleLayout.setBackgroundResource(R.drawable.title_gallery);
		
		
	}
	
	@Override
	public void onClick(View aVa) {
		// TODO Auto-generated method stub
		switch (aVa.getId()) {
		case R.id.bt_save_photo:
			break;
		case R.id.bt_share:
			startActivity(new Intent(GallerySelectedPhoto.this,GalleryShare.class));
			break;
		case R.id.bt_profile:
			break;
		case R.id.btnback:
			finish();
			break;
		}
		super.onClick(aVa);
	}
	
}
